package br.gov.ibama.client.componentes;

import br.gov.ibama.client.comum.Constantes;
import br.gov.ibama.client.eventos.BasisEvent;
import br.gov.ibama.client.eventos.EventoGlobal;

import com.google.gwt.event.shared.SimpleEventBus;
import com.smartgwt.client.widgets.form.fields.TextItem;

public class FolhaEstiloComponentes extends TextItem{
	
	private SimpleEventBus eventoGlobal = EventoGlobal.getInstance();
	
	public void setaObrigatorio() {
		this.setRequired(true);
		this.setRequiredMessage(BasisConstantes.MSG_OBRIGATORIO);
		this.setPrompt(BasisConstantes.MSG_OBRIGATORIO);
	}

	public void setaPadraoCORObrigatorio() {
		this.setTextBoxStyle(Constantes.STYLE_TEXT_BOX_OBRIGATORIO_BLUR);
		this.setHint(BasisConstantes.IMG_HINT_OBRIGATORIO);
		eventoGlobal.fireEvent(new BasisEvent(this.getName(), true));
	}

	public void setaPadraoCORPreenchido() {
		this.setTextBoxStyle(Constantes.STYLE_TEXT_ITEM);
		eventoGlobal.fireEvent(new BasisEvent(this.getName(), false));
	}

}
